/**
 * FileName: MqttServiceImpl
 * Author: Wb
 * Date: 2025/9/25
 */
package org.test.device.service.impl;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.test.device.config.mqtt.MqttGateway;
import org.test.device.service.MqttService;

@Slf4j
@Service
@RequiredArgsConstructor
public class MqttServiceImpl implements MqttService {

    private final MqttGateway mqttGateway;


    /**
     * @Author Wb
     * @Description
     * @Date 14:09 2025/9/25
     * @Param [topic, payload]
     * @Return void
     */
    @Override
    public void publish(String topic, String payload) {
        log.info("MQTT 发布: topic={}, payload={}", topic, payload);
        mqttGateway.sendMessageToMqtt(topic, payload);
    }

    /**
     * @Author Wb
     * @Description
     * @Date 14:09 2025/9/25
     * @Param [topic, qos, payload]
     * @Return void
     */
    @Override
    public void publish(String topic, int qos, String payload) {
        log.info("MQTT 发布: topic={}, qos={}, payload={}", topic, qos, payload);
        mqttGateway.sendMessageToMqtt(topic, qos, payload);
    }
}


